package com.jilujia.web.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import com.jilujia.domain.blog.Blog;

public class BlogCatalogNotNullValidator implements ConstraintValidator<BlogCatalogNotNull, Blog> {

	@Override
	public void initialize(BlogCatalogNotNull blogCatalogNotNull) {
	}

	@Override
	public boolean isValid(Blog blog, ConstraintValidatorContext context) {
		if ((blog.getCatalog() == null) || (blog.getCatalog().getId() == null)) {
			return false;
		}
		return true;
	}
}